import React from 'react'
import { useSelector,useDispatch } from 'react-redux'
import {getmovie} from  '../../stroe/slice/movieSlice'
export default function Movie() {
  const dispatch = useDispatch()
  const count = useSelector(state=>state.count.count) 
  const movieList = useSelector(state=>state.movie.movie) 
  // const movie = useSelector(state=>state.movie)
  const getMovieList = ()=>{
    dispatch( getmovie())
  }

  return (
    <div>
      <h3>我是Moive组件,我收到的Count组件的值是{count}</h3>
      <button onClick={getMovieList}>请求数据</button>
      <ul>
        {
          movieList.map(item=>{
            return <li key={item.tvId}>{item.albumName}</li>
          })
        }
      </ul>
    </div>
  )
}
